package cn.kxx.controller;

import cn.kxx.pojo.Traveller;
import cn.kxx.service.TravellerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @Auther: Kong Xiang Xiang
 * @Date: 2022/11/8 20:29
 * @DESC:
 */

@Controller
@RequestMapping("traveller")
public class TravellerController {


    @Autowired
    private TravellerService travellerService;

    @RequestMapping("findAll")
    private ModelAndView findAll(Integer page, Integer size){
        PageHelper.startPage(page,size);
     List<Traveller> list = travellerService.findAll();
        PageInfo pageInfo = new PageInfo(list);
        ModelAndView mv = new ModelAndView();
        mv.setViewName("traveller-list");
        mv.addObject("pageInfo",pageInfo);
        return mv;


    }


}
